Skip to content

Fix --version and __schema to report the semantic release version#3331

Closed
theletterf wants to merge 2 commits into
mainfrom
fix-cli-version-output
Closed

Fix --version and __schema to report the semantic release version#3331
theletterf wants to merge 2 commits into
mainfrom
fix-cli-version-output

Conversation

@theletterf
Copy link
Copy Markdown
Member

Why

docs-builder --version was printing the CLR assembly file version (1.0.0.0) instead of the MinVer-assigned semantic version. The same value leaked into the version field of the __schema output (used to generate docs/cli-schema.json). On a tagged release the version should be clean — e.g. 1.9.0 — not the CLR default.

This is a follow-up to the Nullean.Argh 0.16.2 bump (#3330), which exposed the mismatch because Argh 0.16.2 switched from AssemblyFileVersionAttribute to AssemblyInformationalVersionAttribute internally. The same fix applies to Argh 0.16.0 as well.

What

Both --version and __schema are now intercepted in Program.cs before Argh's intrinsic handler runs:

  • --version prints AssemblyInformationalVersionAttribute directly and exits.
  • __schema redirects Console.Out to a StringWriter, registers a ProcessExit handler that patches the version JSON field with the informational version, then lets Argh write and exit as normal.

docs/cli-schema.json is regenerated to reflect the change (1.0.0.01.0.0 for local non-MinVer builds; tagged releases will show the clean semver).

Note: merge after #3330, which adds jq-based version-field exclusion to the CI schema diff so the check stays green across canary commits.

Argh was reporting the CLR assembly file version (1.0.0.0) instead of
the MinVer-assigned informational version. Both --version and __schema
are now intercepted before Argh's intrinsic handler so they print the
AssemblyInformationalVersionAttribute value — which on tagged releases
is the clean semver (e.g. 1.9.0) and on canary builds includes the
pre-release suffix.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@theletterf theletterf requested review from a team as code owners May 18, 2026 08:16
@theletterf theletterf added the bug label May 18, 2026
@theletterf theletterf requested a review from technige May 18, 2026 08:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 978e35ab-3337-4515-a020-eb67023bca3d

📥 Commits

Reviewing files that changed from the base of the PR and between 3c9002f and 6e3f3d3.

📒 Files selected for processing (1)
  • src/tooling/docs-builder/Program.cs

📝 Walkthrough

Walkthrough

The PR modifies the docs-builder entry point to ensure the CLI version and schema output report the informational version from assembly metadata rather than the CLR runtime assembly version. It extracts informationalVersion via reflection with fallbacks, intercepts --version to output immediately, and intercepts __schema by capturing stdout and rewriting the JSON version field on process exit using a regex-based helper utility.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing version reporting in both --version and __schema output to use the semantic release version instead of CLR assembly version.
Description check ✅ Passed The description is well-related to the changeset, explaining the problem (CLR assembly version leak), the solution (interception before Argh handler), and implementation details that match the code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix-cli-version-output

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@theletterf
Copy link
Copy Markdown
Member Author

@Mpdreamz After we merge #3330, we still need this fix.

@theletterf theletterf requested a review from Mpdreamz May 18, 2026 09:06
@Mpdreamz
Copy link
Copy Markdown
Member

Fixing this in Argh instead again :)

@Mpdreamz
Copy link
Copy Markdown
Member

nullean/argh#56

@Mpdreamz
Copy link
Copy Markdown
Member

No longer needed :)

@Mpdreamz Mpdreamz closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants